package com.yuezhi.producer.dlx.controller;

import com.yuezhi.producer.constant.QueueConstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/dlx")
public class DlxController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping("/send")
    public void send() {
        rabbitTemplate.convertAndSend(QueueConstant.DLX_SEND_EXCHANGE,QueueConstant.DLX_SEND_QUEUE,"你好！这是一条死信队列消息");
        System.out.println(new Date());
    }
}
